Image classification is an image processing technology that determines classifications based on different characteristics reflected by different images and classifies the images. With the explosion of images on the Internet, the e-commerce field includes a large volume of image information. With image classification, contrabands may be detected and the same type of products may be recommended. Thus, image classification technology is becoming a study focus.
Existing image classification methods generally, based on a pre-generated visual dictionary, represent an image for classification as a visual word for classification histogram, and then determine a classification of the image for classification by an image classifier that is generated based on pre-training. The visual dictionary includes different visual words. Each visual word represents a classification that is obtained through clustering of training image features extracted from a large volume of training images. The histogram of the visual word for classification is a dataset formed by multiple data and is represented by a vector. Each data maps onto a corresponding visual word. Each data value is equal to a weight of the corresponding visual word. The weight represents a similarity degree between a respective image for classification and the classification represented by the corresponding visual word. The image classifier is generated through training by a machine-learning algorithm based on visual word histograms corresponding to each training image. A respective visual word histogram corresponding to a respective training image is also formed in a same method by representing the image for classification as the histogram of the visual word for classification.
The process to represent the image for classification as the histogram of the visual word for classification is as follows. Based on a respective image feature of the image for classification, a visual word in the visual dictionary that is closest to the respective image feature is determined and the respective image feature is quantified as such visual word. Each time the visual word in the visual dictionary is used for quantification, its corresponding weight is increased by 1. When all respective image features are quantified by visual words, the weight of each visual word is also determined to establish the histogram of the visual word for classification. For example, the visual dictionary may be represented as B={b1, b2, b3}, the extracted image features may include X1 and X2, and the corresponding visual word histogram may be represented as C={c1, c2, c3}, where initial values of c1, c2, and c3 are 0. When X1 is determined to be closest to visual word b1, the value of corresponding c1 is increased by 1. If X2 is also determined to be closest to visual word b1, the value of corresponding c1 is also increased by 1. Accordingly, the final established histogram of the visual word for classification corresponding to the image for classification is represented as {2, 0, 0}.
As shown above, the process to establish the histogram of the visual word for classification is to quantify each feature of the image for classification as a visual word. In real applications, the visual word obtained through quantification may not accurately represent the feature of the image to be classified. In addition, quantification error may easily arise when there is an image distortion. For example, the image feature X1 may be closest to b2, under the current method, the image feature X1, however, may be still quantified by the visual word b1. Thus, the established visual word histogram may not be accurate and have errors, which leads to an inaccurate image classification.